package com.lmxdawn.api.admin.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lmxdawn.api.admin.entity.GoldCoin;
import com.lmxdawn.api.admin.entity.Jade;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author huangyubin
 * @since 2024-07-04
 */
public interface JadeMapper extends BaseMapper<Jade> {


    //回滚库存(增加库存并扣减销量)
    @Update("update t_jade set amount=amount+#{num} where id=#{skuId}")
    void resumeStockNum(@Param("skuId") Long skuId, @Param("num") BigDecimal num);

    @Update("update t_jade set amount=amount-#{num} where id=#{skuId}")
    void discountStockNum(@Param("skuId") Long skuId, @Param("num")BigDecimal num);
}
